﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HydraShellServer.Server.Contracts;
using Hydra.Shell.ProjectionAttributes;
using MyRealPackage.Server.Entities;
using System.Collections.ObjectModel;
using Hydra.Shell.Implementations;

namespace MyRealPackage.Server
{
    public class MyRealPackage : HydraPackage
    {
        [Association]
        public EntityObservableCollection<Customer> Customers { get; private set; }

        public MyRealPackage()
        {
            Customers = new EntityObservableCollection<Customer>(new List<Customer>()  
            { 
                new Customer 
                { 
                    ID = Guid.NewGuid().ToString(),
                    Name = "Joe",
                    Orders = new EntityObservableCollection<Order>(new List<Order>()
                    {
                        new Order
                        {
                            ID = Guid.NewGuid().ToString(),
                            OrderNumber = 1,
                            Products = new EntityObservableCollection<Product>(new List<Product>()
                            {
                                new Product
                                {
                                    ID = Guid.NewGuid().ToString(),
                                    Name = "Soap"
                                },
                                new Product
                                {
                                    ID = Guid.NewGuid().ToString(),
                                    Name = "Shaving Cream"
                                }
                            })
                        },
                        new Order
                        {
                            ID = Guid.NewGuid().ToString(),
                            OrderNumber = 2,
                            Products = new EntityObservableCollection<Product>(new List<Product>()
                            {
                                new Product
                                {
                                    ID = Guid.NewGuid().ToString(),
                                    Name = "Toothbrush"
                                },
                                new Product
                                {
                                    ID = Guid.NewGuid().ToString(),
                                    Name = "Comb"
                                }
                            })
                        },
                    })
                }, 
                new Customer 
                { 
                    ID = Guid.NewGuid().ToString(),
                    Name = "Bob",
                    Orders = new EntityObservableCollection<Order>(new List<Order>()
                    {
                        new Order
                        {
                            ID = Guid.NewGuid().ToString(),
                            OrderNumber = 3,
                            Products = new EntityObservableCollection<Product>(new List<Product>()
                            {
                                new Product
                                {
                                    ID = Guid.NewGuid().ToString(),
                                    Name = "Bananas"
                                },
                                new Product
                                {
                                    ID = Guid.NewGuid().ToString(),
                                    Name = "Strawberries"
                                },
                                new Product
                                {
                                    Name = "Bread"
                                }                            
                            })
                        },
                        new Order
                        {
                            ID = Guid.NewGuid().ToString(),
                            OrderNumber = 4,
                            Products = new EntityObservableCollection<Product>(new List<Product>()
                            {
                                new Product
                                {
                                    ID = Guid.NewGuid().ToString(),
                                    Name = "Beer"
                                },
                                new Product
                                {
                                    ID = Guid.NewGuid().ToString(),
                                    Name = "Ice"
                                }
                            })
                        },
                        new Order
                        {
                            ID = Guid.NewGuid().ToString(),
                            OrderNumber = 4,
                            Products = new EntityObservableCollection<Product>(new List<Product>()
                            {
                                new Product
                                {
                                    ID = Guid.NewGuid().ToString(),
                                    Name = "Aspirin"
                                }
                            })
                        },                    
                    })
                } 
            });
        }
    }
}
